package com.trkj.pojos;

import java.io.Serializable;
import javax.persistence.*;

import org.springframework.context.annotation.Lazy;

import java.math.BigDecimal;
import java.util.Date;
import java.util.List;


/**
 * The persistent class for the CARD database table.
 * 
 */
@Entity
@NamedQuery(name="Card.findAll", query="SELECT c FROM Card c")
public class Card implements Serializable {
	private static final long serialVersionUID = 1L;

	@Id
	@Column(name="CRAD_ID")
	private String cradId;

	private String address;

	private BigDecimal age;

	@Column(name="ID_CARD")
	private String idCard;

	private String name;

	private String sex;
	
	private String status;

	@Temporal(TemporalType.TIMESTAMP)
	@Column(name="TIME_")
	private Date time;

	//bi-directional many-to-one association to HospEmerRegistration
	@OneToMany(mappedBy="card")
	private List<HospEmerRegistration> hospEmerRegistrations;

	//bi-directional many-to-one association to HospPatientRegistration
	@OneToMany(mappedBy="card")
	private List<HospPatientRegistration> hospPatientRegistrations;

	//bi-directional many-to-one association to LiveinrecordTable
	@OneToMany(mappedBy="card")
	private List<LiveinrecordTable> liveinrecordTables;

	public Card() {
	}

	public String getCradId() {
		return this.cradId;
	}

	public void setCradId(String cradId) {
		this.cradId = cradId;
	}

	public String getAddress() {
		return this.address;
	}

	public void setAddress(String address) {
		this.address = address;
	}

	public BigDecimal getAge() {
		return this.age;
	}

	public void setAge(BigDecimal age) {
		this.age = age;
	}

	public String getIdCard() {
		return this.idCard;
	}

	public void setIdCard(String idCard) {
		this.idCard = idCard;
	}

	public String getName() {
		return this.name;
	}

	public void setName(String name) {
		this.name = name;
	}

	public String getSex() {
		return this.sex;
	}

	public void setSex(String sex) {
		this.sex = sex;
	}

	public String getStatus() {
		return this.status;
	}

	public void setStatus(String status) {
		this.status = status;
	}

	public Date getTime() {
		return this.time;
	}

	public void setTime(Date time) {
		this.time = time;
	}

	public List<HospEmerRegistration> getHospEmerRegistrations() {
		return this.hospEmerRegistrations;
	}

	public void setHospEmerRegistrations(List<HospEmerRegistration> hospEmerRegistrations) {
		this.hospEmerRegistrations = hospEmerRegistrations;
	}

	public HospEmerRegistration addHospEmerRegistration(HospEmerRegistration hospEmerRegistration) {
		getHospEmerRegistrations().add(hospEmerRegistration);
		hospEmerRegistration.setCard(this);

		return hospEmerRegistration;
	}

	public HospEmerRegistration removeHospEmerRegistration(HospEmerRegistration hospEmerRegistration) {
		getHospEmerRegistrations().remove(hospEmerRegistration);
		hospEmerRegistration.setCard(null);

		return hospEmerRegistration;
	}

	public List<HospPatientRegistration> getHospPatientRegistrations() {
		return this.hospPatientRegistrations;
	}

	public void setHospPatientRegistrations(List<HospPatientRegistration> hospPatientRegistrations) {
		this.hospPatientRegistrations = hospPatientRegistrations;
	}

	public HospPatientRegistration addHospPatientRegistration(HospPatientRegistration hospPatientRegistration) {
		getHospPatientRegistrations().add(hospPatientRegistration);
		hospPatientRegistration.setCard(this);

		return hospPatientRegistration;
	}

	public HospPatientRegistration removeHospPatientRegistration(HospPatientRegistration hospPatientRegistration) {
		getHospPatientRegistrations().remove(hospPatientRegistration);
		hospPatientRegistration.setCard(null);

		return hospPatientRegistration;
	}

	public List<LiveinrecordTable> getLiveinrecordTables() {
		return this.liveinrecordTables;
	}

	public void setLiveinrecordTables(List<LiveinrecordTable> liveinrecordTables) {
		this.liveinrecordTables = liveinrecordTables;
	}

	public LiveinrecordTable addLiveinrecordTable(LiveinrecordTable liveinrecordTable) {
		getLiveinrecordTables().add(liveinrecordTable);
		liveinrecordTable.setCard(this);

		return liveinrecordTable;
	}

	public LiveinrecordTable removeLiveinrecordTable(LiveinrecordTable liveinrecordTable) {
		getLiveinrecordTables().remove(liveinrecordTable);
		liveinrecordTable.setCard(null);

		return liveinrecordTable;
	}

	public Card(String cradId, String address, BigDecimal age, String idCard, String name, String sex, String status,
			Date time) {
		super();
		this.cradId = cradId;
		this.address = address;
		this.age = age;
		this.idCard = idCard;
		this.name = name;
		this.sex = sex;
		this.status = status;
		this.time = time;
	}

	@Override
	public String toString() {
		return "Card [cradId=" + cradId + ", address=" + address + ", age=" + age + ", idCard=" + idCard + ", name="
				+ name + ", sex=" + sex + ", status=" + status + ", time=" + time + "]";
	}
	
}